package cn.myschool.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

/**
 * @author oldliu
 * @since 1.0
 */
public class DriverTest {
    public static void main(String[] args) throws Exception {
        //Driver d=new Driver();
        ///DriverManager.registerDriver(d);
        //Connection con=
        Class.forName("com.mysql.jdbc.Driver");
        Connection connection = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/java78", "root", "root1234");
        System.out.println(connection.getClass().getName()+"实现类");
        PreparedStatement ps=connection.prepareStatement("select * from java76.s_grade");
        System.out.println(ps.getClass().getName());
        ResultSet rs = ps.executeQuery();
        System.out.println(rs.getClass().getName()+" 实现类：");
        while (rs.next()){
            System.out.println(rs.getLong("id"));
            System.out.println(rs.getString("gname"));
        }
        rs.close();
        ps.close();
        connection.close();

    }
}
